<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="/classes/CommonHelper.class.jsp" %>
<%@ include file="/classes/DBHelper.class.jsp" %>
<%@ include file="/classes/GUID.class.jsp"%>
<%@ include file="/classes/MessageUtil.class.jsp"%>
<%
	request.setCharacterEncoding("UTF-8");
	String question = getParameter(request,"question");
	String answer = getParameter(request,"answer");
	String type_id = getParameter(request,"type_id");
	String dept_name = getParameter(request,"dept_name");
	
	
	
	if(nullOrEmpty(question)||nullOrEmpty(answer)||nullOrEmpty(type_id)){
		out.print(getAlertMessage(request,"请填写所有带（*）的选项！","zspj_list.jsp?r="+new Date().getTime(),true));
		return;
	}
	
	String guid = getGUID();
	
	String sql = "insert into APP_ZSPJ (guid,question,answer,type_id,dept_name) values (?,?,?,?,?)";
	int count = executeUpdate(sql,new Object[]{guid,question,answer,type_id,dept_name});
	if(count>0){
		out.print(getAlertMessage(request,"添加知识普及成功！","zspj_list.jsp?r="+new Date().getTime(),true));
		return;
	}else{
		out.print(getAlertMessage(request,"添加知识普及失败！","zspj_list.jsp?r="+new Date().getTime(),true));
		return;
	}
	
%>